Skip to content

London | 26-ITP-Sep| Abdennour Hachemi| Sprint 2 | Coursework - #1547

Open
AbdennourHachemi wants to merge 30 commits into
CodeYourFuture:mainfrom
AbdennourHachemi:coursework/sprint-2
Open

AbdennourHachemi wants to merge 30 commits into
CodeYourFuture:mainfrom
AbdennourHachemi:coursework/sprint-2

Conversation

@AbdennourHachemi

@AbdennourHachemi AbdennourHachemi commented Sep 20, 2026

Copy link
Copy Markdown

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Task code

CYF-1039

A solution to all exercies in Sprint 2. Thanks for reviwing it!

@netlify

netlify Bot commented Sep 20, 2026

Copy link
Copy Markdown

Deploy Preview for cyf-onboarding-module ready!

Name Link
🔨 Latest commit d7636e9
🔍 Latest deploy log https://app.netlify.com/projects/cyf-onboarding-module/deploys/6ab14a64a0393b0008b78b15
😎 Deploy Preview https://deploy-preview-1547--cyf-onboarding-module.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
2 paths audited
Performance: 100 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 86 (no change from production)
PWA: -
View the detailed breakdown and full score reports
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@AbdennourHachemi AbdennourHachemi added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Sep 20, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Sep 20, 2026
@AbdennourHachemi AbdennourHachemi added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Sep 20, 2026

@abdishakoor-dev abdishakoor-dev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, this is thorough. The table of function calls in 1-percentage-change.js is a good way to answer a), all five are right, and 2-mandatory-errors/3.js is a model answer: a prediction, the exact error, and three different ways to fix it.

A few things to fix:

  1. .gitignore is in this PR and it is not part of the task. See my comment.

  2. 1-key-exercises/3-paths.js line 20, see my comment.

  3. 1-key-exercises/4-random.js, see my comment.

  4. 2-mandatory-errors/1.js, see my comment.

  5. 3-mandatory-interpret/2-time-format.js answer f), see my comment.

  6. Could you run Prettier on the files you have changed? Eleven of them are not formatted at the moment.

Add the Needs Review label again when you have pushed.

Comment thread .gitignore Outdated
.DS_Store
.vscode
**/.DS_Store No newline at end of file
**/.DS_Storeeducation-blog/education-blog

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things here. This file is not part of the Sprint 2 task, which is what the bot at the top of the page is complaining about. Run git checkout main -- .gitignore to put it back, then commit and push.

Also worth seeing what happened: your new entry got joined onto the end of the previous line, so the file now reads **/.DS_Storeeducation-blog/education-blog as a single pattern. That matches nothing, so **/.DS_Store has stopped working too.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorted, .gitignore matches main again and the bot is happy.

Comment thread Sprint-2/1-key-exercises/3-paths.js Outdated

const dir = ;
const ext = ;
const dir = filePath.slice(1,lastSlashIndex);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run this file and read the dir line. It prints Users/mitch/... but the path starts with a /, so the first character is missing. What is the 1 doing as the first argument to slice, and what would happen if it were 0?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the one. dir prints the whole path now.

Comment thread Sprint-2/1-key-exercises/4-random.js Outdated
test = test+ minimum;
console.log("test+ minimum" , test)

// Last operation is to add 1 to num 1 is stored in a variable called minimum

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line says 1 is stored in minimum, but you changed line 1 to const minimum = 10, so the two no longer agree.

There is something else worth checking here. Look at the order you do the steps in. On line 28 you add minimum, then on line 33 you use Math.floor. Now look at line 4: which of those two happens first there? Does the order change the answer?

And your comments walk through the steps well, but they never say what num ends up being. What is the smallest value it can have, and the largest?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The order is right now and you have said what num ends up being. One thing left on the last step, see my new comment on line 27.

// trying to create an age variable and then reassign the value by 1

const age = 33;
let age = 33;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix is right and the file runs. This section also asks you to interpret the error and explain why it happened, and there is nothing written down here. You did that well in 2.js, 3.js and 4.js, so the same again. What did node print before you changed const to let?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, the message and the reason are both written down now.

/* movieLength = 60 => exactMovieLength = 0:1:0 */
/* movieLength = 3676 => exactMovieLength = 1:1:16 */
/* */
/* This code work for all values of movieLength provided that it doesn't exeed 86400 which is 24 hours = 1 day (realisticly no movie is over 24 hours) */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your three examples above are all correct, I ran them. This conclusion is not right though. Try 90000 and see what you get; going over 24 hours is fine.

Look again at your own 60 => 0:1:0 example. Is that how a clock shows one minute? And try a negative number, and one with a decimal like 90.5.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better. I ran -3600 and 90000 and got what you wrote.

@abdishakoor-dev abdishakoor-dev added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Sep 20, 2026
@abdishakoor-dev abdishakoor-dev added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Sep 20, 2026
@AbdennourHachemi AbdennourHachemi added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Sep 20, 2026

@abdishakoor-dev abdishakoor-dev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last step on line 27 is right now, thanks.

Two things left:

  1. 1-key-exercises/4-random.js: the sentence that said what num ends up being was in the line you replaced, so it has gone. See my reply on line 27.

  2. The formatting. This is the third time I have asked, and it is what holds this PR back now. None of the eleven files has changed since the first review, so they all still fail Prettier.

    In VS Code, open each file you changed, right click in the editor and choose Format Document. If VS Code asks which formatter to use, pick Prettier. Save, commit and push. If Format Document is not in the menu, or nothing changes, tell me here and we can sort it out.

Add the Needs Review label again once you have pushed.

@abdishakoor-dev abdishakoor-dev added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Sep 21, 2026
@AbdennourHachemi

AbdennourHachemi commented Sep 21, 2026

Copy link
Copy Markdown
Author

Thanks Abdi, Sorry that you have to ask three times for the formatting issue, i am still not able to do proper setting for prettier, I will try to fix this issue so it wont be replicated.

@AbdennourHachemi AbdennourHachemi added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Sep 21, 2026

@abdishakoor-dev abdishakoor-dev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prettier passes on every file now, thanks. No need to apologise.

One thing left, in 1-key-exercises/4-random.js. Line 23 is an example of the last step. It does not say what num is. Your earlier version had the answer: num is a random whole number from 1 to 100. Add that as the last line of the file.

For next time, format on save does the Prettier step for you. If the steps in practical_guide.md do not work, tell me what you see.

Add the Needs Review label again once you have pushed.

@abdishakoor-dev abdishakoor-dev added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Sep 21, 2026
@AbdennourHachemi AbdennourHachemi added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Sep 21, 2026

@abdishakoor-dev abdishakoor-dev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 24 is the answer, thanks. That part is done.

One small thing is left. 1-key-exercises/4-random.js fails Prettier again. Your last commit added two lines at the end of the file: an empty line, and a line with two spaces. Open the file, right click and choose Format Document. Save, commit and push.

Format on save stops this from happening. The steps are here: https://github.com/CodeYourFuture/Module-JavaScript-Fundamentals/blob/main/practical_guide.md

To check format on save works: add an empty line at the end of the file and save. If the line stays, format on save is not on yet. Tell me what you see.

Add the Needs Review label again once you have pushed.

@abdishakoor-dev abdishakoor-dev added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Sep 21, 2026
@AbdennourHachemi AbdennourHachemi added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Sep 21, 2026

@abdishakoor-dev abdishakoor-dev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All fixed, marking this as Complete. Well done.

@abdishakoor-dev abdishakoor-dev added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants